#include<stdio.h>
#include<unistd.h>
#include<stdlib.h>
#include<sys/wait.h>
#include<sys/types.h>

//int main()
//{
//  printf("begin...\n");
//  printf("begin...\n");
//  printf("begin...\n");
//  printf("begin...\n");
//  printf("begin...\n");
//
//  printf("我已经是一个进程啦,pid:%d\n",getpid());
//  execl("/bin/ls","ls","-l","-a",NULL);
//
//
//  printf("end...\n");
//  printf("end...\n");
//  printf("end...\n");
//  printf("end...\n");
//  printf("end...\n");
//  return 0;
//}

int main()
{
  pid_t id=fork();
  if(id==0)
  {
    //child
    printf("我是子进程:%d\n",getpid());
   //execl("/bin/lssssss","ls","-l","-a",NULL);
   // char* const argv[]={
   //  "ls",
   //  "-l",
   //  "-a",
   //  NULL
   // };
   // //execv("/bin/ls",argv);
   // 
   ////execlp("ls","ls","-l","-a",NULL);
   //execvp("ls",argv);
   
   // char*const myenv[]={
   //   "MYENV=YouCanSeeMe",
   //   NULL
   // };
  //  putenv("MYENV=YouCanSeeMe");
  //  extern char** environ;
  //  execle("./otherproc/otherproc","otherproc",NULL,environ);
    //execl("./otherproc/shell.sh","bash shell.sh",NULL);
    execl("./otherproc/test.py","python3 test.py",NULL);
    exit(1);
  }

  //father
  
  sleep(1);
  int status=0;
  printf("我是父进程:%d\n",getpid());
  waitpid(id,&status,0);
  printf("child exit node:%d\n",WEXITSTATUS(status));

  return 0;
}
